import request from "../utils/request";

//获得子女列表接口
export const childListService = (uid) => {
  return request.post("/parent/list/student", { uid });
};

//绑定子女接口
export const bindChildService = (pid, sid) => {
  return request.post("/parent/bind", { pid, sid });
};

//返回父母的试卷列表
export const parentTestListService = (uid) => {
  return request.post("/parent/test/list/parent", { uid });
};

//查看父母试题问题接口
export const checkParentQuestionService = (uid, tid) => {
  return request.post("/parent/question/all/parent", { user: { uid }, test: { tid } });
};

//删除试题接口
export const deleteParentTestService = (tid, uid) => {
  return request.post("/parent/test/delete", { tid, uid });
};

//获取子女的试题列表接口
export const childQuestionListService = (uid,subject,uname) => {
  return request.post("/parent/test/list", { uid, subject, uname});
};

//查看子女试题接口
export const checkChildQuestionService = (uid, tid) => {
  return request.post("/parent/question/all", { user: { uid }, test: { tid } });
};

//AI生成试卷接口
export const aiCreateQuestionParentService = (uid, form) => {
  return request.post("/parent/create/ai", {
    test: {
      tname: form.name,
      subject: form.subject,
      cnum: form.singleChoice,
      fnum: form.gapFilling,
      snum: form.freeResponse,
      kpoint: form.knowledgePoint,
    },
    user: { uid },
  });
};

//获取数据库里面所有的这个学科的对应知识点的题目接口
export const parentHumanQuestionService = (uid, form, type = null, content = null, kpoint = null, page = 1) => {
  return request.post("/student/human/question", {
    test: {
      tname: form.name,
      subject: form.subject,
    },
    user: { uid },
    type: type,
    content: content,
    kpoint: kpoint,
    page: page
  });
};

//人工组卷接口
export const parentCreateHumanService = (uid, form, questionMap) => {
  return request.post("/parent/create/human", {
    test: {
      tid: form.tid,
      subject: form.subject,
    },
    user: { uid },
    questionMap,
  });
};

//保存试卷接口
export const preserveQuestionService = (questionList) => {
  return request.post("/parent/do/homework", questionList);
};

//提交试卷批改接口
export const correctingQuestionService = (questionList) => {
  return request.post("/parent/correcting/ai", questionList);
};

//重置试卷接口
export const resetQuestionService = (tid, uid) => {
  return request.post("/parent/question/reset", {
    tid,
    uid,
  });
};

//下发试卷接口
export const postQuestionService = (tid, uid) => {
  return request.post("/parent/set/test", {
    tid,
    uid,
  });
};

//获取子女的分析列表接口
export const childAnalysisListService = (uid,subject,uname) => {
  return request.post("/parent/analysis/list", { uid, subject, uname});
};
//获取子女学习情况
export const studentAnalysisListService1 = (uid,subject,sid) => {
  return request.post("/parent/student/analysis1", { uid, subject, sid});
};
export const studentAnalysisListService2 = (uid,subject,sid) => {
  return request.post("/parent/student/analysis2", { uid, subject, sid});
};

export const studentAnalysisListService3 = (uid,subject,sid) => {
  return request.post("/parent/student/analysis3", {uid,subject,sid});
};

export const studentAnalysisListService4 = (uid,subject,sid) => {
  return request.post("/parent/student/analysis4", { uid, subject, sid});
};

